﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FileTaggerData.Helpers;
using NHibernate;
using FileTaggerData.Domain;

namespace FileTags
{
    public partial class SearchForm : Form
    {
        public FileForm FrmFile { get; set; }
        
        public SearchForm()
        {
            InitializeComponent();
        }

        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (ISession session = FactoryHolder.GetSession())
            {
                using (ITransaction trans = session.BeginTransaction())
                {
                    try
                    {
                        FileTag tag = session.Load<FileTag>(1);

                        tag.Description = "Hello world";
                        session.SaveOrUpdate(tag);
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                    } 
                }
                
            }            
            
        }
    }
}
